-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: migrate expect
and @jest/expect
type tests to TSTyche
#14910
Conversation
✅ Deploy Preview for jestjs ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
expect(jestExpect(null)).type.toHaveProperty('toMatchSnapshot'); | ||
|
||
expect(_expect(null)).type.not.toHaveProperty('toMatchSnapshot'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TSTyche can check if property exists. That’s way better than just expectError
.
test('is superset of `Expect`', () => { | ||
expect<typeof jestExpect>().type.toMatch<typeof _expect>(); | ||
|
||
expect<typeof _expect>().type.not.toMatch<typeof jestExpect>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fun to play with .toMatch()
. That’s another novelty and it does the right job here.
}); | ||
|
||
test('does not define the `.toMatchSnapshot()` matcher', () => { | ||
expect(_expect(null)).type.not.toHaveProperty('toMatchSnapshot'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jestExpect
would not look right here, or? This is expectExpect
, but expect(expectExpect
is somewhat too much.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha
@SimenB Did I address all your comments? Or did I miss something? No rush, if you are busy. This can wait. Just checking if some more changes are expected or not. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great stuff, thanks!
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
This PR migrates
expect
and@jest/expect
type tests to TSTyche. The diff is noisy, but the tests look much better.Test plan
Type test must pass in CI.